<?php 
	class LoginController extends Controller{
		private $model;


		public function __init(){
			$this->model = K('user');
		}

		public function register(){
			// echo "123";
			if(IS_POST){
				// echo "123";
				if($this->model->addUser()){
					$this->success('注册成功',U('Login/login'));
				}else{
					$this->success('注册失败');
				}
			}else{
				// echo "123";die;
				$this->display();
			}
		}

	
		#######################登陆########################
		public function login(){
			if(IS_POST){
				if($user = $this->model->login()){
					$_SESSION['user'] = $user;	
					$this->success('登陆成功',U('Index/index'));				
				}else{
					$this->error('用户名密码错误');
				}			
		}else{
			$this->display();
		}
	}

	// ############################验证用户方法#####################
	// 需要牵扯到ajax,所以暂时不做

	public function code(){
		$code = new Code();
		$code->show();
	}









	}


 ?>